﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cl.Utils.Extention
{
    public static class Extensions_List
    {

        public static List<T> GetClPageList<T>(this List<T> source, int pageIndex, int pageSize, ref int totalNumber)
        {
            if (pageIndex < 1)
                pageIndex = 1;
            var itemIndex = (pageIndex - 1) * pageSize;
            var pageOfItems = source.Skip(itemIndex).Take(pageSize).ToList();
            totalNumber = source.Count();

            return pageOfItems;
        }

    }
}
